Entities, Entity Sets and Entity Types
In this lesson, we will discuss the first component of an ER diagram: entities.
We'll cover the following
What is an entity?#
An entity is an object in the real world with an independent existence that can be differentiated from other objects. An entity might be:
- An object with physical existence (e.g., a lecturer, a student, a car).
- An object with conceptual existence (e.g., a course, a job, a position).
Each entity has attributes which are the particular properties that describe it. For example, an EMPLOYEE entity may be described by the employee’s name, age, address, salary, etc. A particular entity will have a value for each of its attributes (e.g. an employee named Steve, who is 23 years old, lives in Ohio, and earns $50,000, etc.). The attribute values that describe each entity become a major part of the data stored in the database.
Entity types and entity sets#
A database usually contains groups of entities that are similar. For example, a company employing hundreds of employees may want to
store similar information concerning each of their employees. These EMPLOYEE entities share the same attributes (like Name
, Salary
, Age
), but each entity has its own values for each attribute. An entity type defines a collection (or set) of entities that have the same attributes. Each entity type in the database is described by its name and attributes.
The figure below shows the EMPLOYEE entity type as well as a list of some of the attributes for that type. A few individual entities are also illustrated, along with the values of their attributes.
The collection of all entities of a particular entity type in the database at any point in time is called an entity set. The entity set is usually referred to using the same name as the entity type, even though they are two separate concepts.
Representation in ER diagrams#
An entity type is represented in ER diagrams as a rectangular box enclosing the name of the entity type. For example we can see the entities from the previous lesson below:
In the next lesson, we will expand the concept of attributes and highlight the different types of attributes in an ER diagram.